package org.jiajin2coding.reggie.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jiajin2coding.reggie.entity.Employee;
import org.jiajin2coding.reggie.mapper.EmployeeMapper;
import org.jiajin2coding.reggie.service.IEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Guo Jinhua (jiajin2coding)
 * @version 1.0.0
 * @className EmployeeServiceImpl
 * @description
 * @date 2023-10-24
 */
@Service
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee> implements IEmployeeService {

    @Autowired
    private EmployeeMapper employeeMapper;

    /**
     * 更具username查询用户信息
     *
     * @param username
     * @return
     */
    @Override
    public Employee queryEmployeeInfoByName(String username) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("username", username);
        wrapper.eq("status", 1);
        return employeeMapper.selectOne(wrapper);
    }
}
